ServiceCompat

Helper for accessing features in android.app.Service.

Types

Link copied to clipboard

Properties

Link copied to clipboard
val START_STICKY: Int = 1
Constant to return from onStartCommand: if this service's process is killed while it is started (after returning from onStartCommand), then leave it in the started state but don't retain this delivered intent.
Link copied to clipboard
Flag for stopForeground: if set, the notification previously provided to startForeground will be detached from the service.
Link copied to clipboard
Flag for stopForeground: if set, the notification previously provided to startForeground will be removed.

Functions

Link copied to clipboard
open fun startForeground(@NonNull service: @NonNull Service, id: Int, @NonNull notification: @NonNull Notification, foregroundServiceType: Int)
startForeground with the third parameter foregroundServiceType was added in Q.
Link copied to clipboard
open fun stopForeground(@NonNull service: @NonNull Service, flags: Int)
Remove the passed service from foreground state, allowing it to be killed if more memory is needed.